<!DOCTYPE html>
<html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
    <title>jQuery弹出层</title>
    <script src="./jquery.js" type="text/javascript"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            /* background: #000; */
        }

        #Button1 {
            padding: 9px 14px;
            outline: none;
            border: none;
            background-color: pink;
            color: rgb(165, 65, 65);
            cursor: pointer;
            margin: 20px;
        }

        .black_overlay {
            display: none;
            position: absolute;
            width: 1920px;
            height: 1080px;
            background: rgba(0, 0, 0, 0.71);
            opacity: 1;
            top: 0%;
            left: 0%;
            z-index: 1001;
        }

        .white_content {
            display: none;
            position: absolute;
            top: 332px;
            left: 595px;
            width: 730px;
            height: 408px;
            background: #03173F;
            color: #fff;
            border: 2px solid #1493E6;
            z-index: 1002;
            overflow: auto;
        }

        .white_content_small {
            display: none;
            position: absolute;
            top: 20%;
            left: 30%;
            width: 40%;
            height: 50%;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }

        .btn {
            width: 56px;
            height: 32px;
            background: #002E60;
            border: 1px solid #53C4FF;
            opacity: 1;
            color: #53C4FF;
            border-radius: 4px;
            margin-right: 20px;
        }
        .pos-btn{
            position: absolute;
            bottom: 262px;
            right: 576px;
        }
    </style>
    <script type="text/javascript">
        //弹出隐藏层
        function ShowDiv(show_div, bg_div) {
            document.getElementById(show_div).style.display = 'block';
            document.getElementById(bg_div).style.display = 'block';
            var bgdiv = document.getElementById(bg_div);
            bgdiv.style.width = document.body.scrollWidth;
            // bgdiv.style.height = $(document).height();
            $("#" + bg_div).height($(document).height());
        };
        //关闭弹出层
        function CloseDiv(show_div, bg_div) {
            document.getElementById(show_div).style.display = 'none';
            document.getElementById(bg_div).style.display = 'none';
        };
    </script>
</head>

<body>
    <button id="Button1" onclick="ShowDiv('MyDiv','fade')">点击弹出层</button>
    <!--弹出层时背景层DIV-->
    <div id="fade" class="black_overlay">
        <div class="pos-btn">
            <button class="btn">提交</button>
            <button class="btn" onclick="CloseDiv('MyDiv','fade')">取消</button>
        </div>
    </div>
    <div id="MyDiv" class="white_content">
        <!-- <div style="text-align: right; cursor: default; height: 30px;"> -->
        <!-- <span style="font-size: 16px;cursor: pointer;padding: 5px;" onclick="CloseDiv('MyDiv','fade')">关闭</span> -->
        <!-- </div> -->
        用在项目中还不错。
        
    </div>
</body>

</html>